const { create, selectList } = require("../server/labelServer.js");

class LabelController {
	async create(ctx, next) {
		// 1. 获取ctx的body参数
		const { label } = ctx.request.body;
		// 2. 填入数据库
		const result = await create(label);
		if (result) {
			ctx.body = {
				code: 0,
				message: "新增标签成功~",
				result,
			};
		}
	}

  async getList(ctx, next) {
		//  获取参数
		const {offset ,size} = ctx.query
		// 2. 填入数据库
		const result = await selectList(offset ,size);
		if (result) {
			ctx.body = {
				code: 0,
				message: "获取标签列表成功~",
				result,
			};
		}
	}

}

module.exports = new LabelController();
